/*
Please Do Not use this code in c++ module.
This function is for uzing (C#)
*/


#include <Inklude/Inklude.h>
#include <Inklude/ikCSharedMemory.h>
#include <Inklude/ikCString.h>

using namespace Inklude;

INKLUDE_C_EXPORT void* _inklude_shared_memory_for_uzing_createInstance()
{
    ikCSharedMemory* pMem = new ikCSharedMemory();
    return pMem;
}

INKLUDE_C_EXPORT bool _inklude_shared_memory_for_uzing_createMemory(void* pMem, LPCWSTR shrdMemName, unsigned int memSize)
{
    Inklude::ikCString strName(shrdMemName);
    return reinterpret_cast<ikCSharedMemory*>(pMem)->CreateMemory(strName, memSize);
}

INKLUDE_C_EXPORT bool _inklude_shared_memory_for_uzing_readMemory(void* pMem, PBYTE buffer, unsigned int readSize, unsigned int offSet)
{
    return reinterpret_cast<ikCSharedMemory*>(pMem)->ReadMemory(reinterpret_cast<char*>(buffer), readSize, offSet);
}

INKLUDE_C_EXPORT bool _inklude_shared_memory_for_uzing_writeMemory(void* pMem, PBYTE buffer, unsigned int writeSize, unsigned int offSet)
{
    return reinterpret_cast<ikCSharedMemory*>(pMem)->WriteMemory(reinterpret_cast<char*>(buffer), writeSize, offSet);
}

INKLUDE_C_EXPORT bool _inklude_shared_memory_for_uzing_isNewlyWritten(void* pMem)
{
    return reinterpret_cast<ikCSharedMemory*>(pMem)->IsNewlyWritten();
}
